#ifndef GAMEWIDGET_H
#define GAMEWIDGET_H

#include <QWidget>
#include <QTcpSocket>
#include "Snaker.h"
#include "Protocol.h"
#include <QList>
#include <QPoint>
#include <QColor>

class GameWidget : public QWidget
{
    Q_OBJECT
public:
    struct NetSnaker{
        QString clientID;
        QList<QPoint> pointList;
        QColor color;
        int score;
    };
private:
    int widgetSize;
    QList<int> mKeyList;

public:
    QList<NetSnaker> mSnakerList;
    QList<QPoint> mFoodList;

    explicit GameWidget(QWidget *parent = 0);
    QList<int> getKeyList();
    void setKeyList(QList<int> keyList);

signals:
    void write_socket(const QByteArray& buf);

protected slots:

protected:
    void paintEvent(QPaintEvent*);
    void keyPressEvent(QKeyEvent*);
};

#endif // GAMEWIDGET_H
